package server;

import logic.Document;
import logic.Template;
import net.tcp.TcpServer;

public class TcpServerRunner {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		TcpServer tcpServer = new TcpServer(GlobalConfig.TCP_DOCUMENT_RETR_PORT, new RetrieverRemoteMethodExecutor(
				new ServerRetriever<Document>(GlobalConfig.DOCUMENT)));
		tcpServer.start();
		TcpServer tcpServer2 = new TcpServer(GlobalConfig.TCP_TEMPLATE_RETR_PORT, new RetrieverRemoteMethodExecutor(
				new ServerRetriever<Template>(GlobalConfig.TEMPLATE)));
		tcpServer2.start();
		TcpServer tcpServer3 = new TcpServer(GlobalConfig.TCP_LOGON_PORT, new LogonRemoteMethodExecutor());
		tcpServer3.start();
		TcpServer tcpServer4 = new TcpServer(GlobalConfig.TCP_LIST_PORT, new ListRemoteMethodExecutor());
		tcpServer4.start();
		TcpServer tcpServer5 = new TcpServer(GlobalConfig.TCP_REPORTER_PORT, new ReporterRemoteMethodExecutor());
		tcpServer5.start();

		try {
			tcpServer.join();
			tcpServer2.join();
			tcpServer3.join();
			tcpServer4.join();
			tcpServer5.join();
		} catch (InterruptedException e) {

			e.printStackTrace();
		}

	}

}
